<template>
  <div>
    <div v-for="menu in menus" :key="menu.path">
      <el-submenu
        v-if="menu.children && menu.children.length > 0"
        :index="menu.path"
      >
        <template slot="title">
          <i :class="menu.meta.icon" style="color: #509fee !important;"></i>
          <span>{{ menu.meta.title }}</span>
        </template>
        <navbar-item :menus="menu.children"></navbar-item>
      </el-submenu>
      <el-menu-item
        v-else
        :index="menu.path"
        style="
          color: black !important;
          background-color: white !important;
          min-width: 150px;
          padding: auto;
        "
      >
        <i :class="menu.meta.icon" style="color: #509fee !important;"></i>
        <span slot="title">{{ menu.meta.title }}</span>
      </el-menu-item>
    </div>
  </div>
</template>

<script>
export default {
  name: 'NavbarItem',
  props: {
    menus: {
      type: Array,
      require: true,
    },
  },
}
</script>

<style>
.el-menu--collapse .el-submenu__title span {
  display: none;
}
i.el-submenu__icon-arrow.el-icon-arrow-right {
  display: none;
}
</style>
